package com.dayuanit.dy17.atm.mapper;

import com.dayuanit.dy17.atm.entity.Card;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CardMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Card record);

    int insertSelective(Card record);

    Card selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Card record);

    int updateByPrimaryKey(Card record);

    Card getByNumber(String cardNum);

    List<Card> listByUserId(Long userId);

    Card getById4Lock(Long cardId);

    int updateBalance(@Param("cardId") Long cardId,
                      @Param("newBalance") Integer newBalance,
                      @Param("oldBalance") Integer oldBalance);
}